import * as React from 'react'
import * as PropTypes from 'prop-types'
import classNames from 'classnames'

import { ColProps, ColState } from './interface'

class Col extends React.Component<ColProps, ColState> {

  static defaultProps = {
    prefixCls: 'layui-col'
  }

  constructor(props: ColProps) {
    super(props)
    this.state = {

    }
  }
  render() {

    const {
      lg, xs, md, sm,
      lgOffset, xsOffset, mdOffset, smOffset,
      children,
      prefixCls,
      className,
      ...restProps
    } = this.props

    const classes = classNames(prefixCls, className, {
      [`${prefixCls}-lg${lg}`]: lg,
      [`${prefixCls}-lg-offset${lgOffset}`]: lgOffset,
      [`${prefixCls}-xs${xs}`]: xs,
      [`${prefixCls}-xs-offset${xsOffset}`]: xsOffset,
      [`${prefixCls}-md${md}`]: md,
      [`${prefixCls}-md-offset${mdOffset}`]: mdOffset,
      [`${prefixCls}-sm${sm}`]: sm,
      [`${prefixCls}-sm-offset${smOffset}`]: smOffset,
    }
  )
  
    return (
      <div
        className={classes}
        {...restProps}
      >{children}</div>
    )
  }
}

export default Col